home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000217-20000824 / 000114_news@columbia.edu _Tue Mar 14 10:43:34 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  5KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA26945
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Tue, 14 Mar 2000 10:43:34 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id KAA25832
  7.     for kermit.misc@watsun.cc.columbia.edu; Tue, 14 Mar 2000 10:29:43 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Re: Sockets programming: telnet problem.
  11. Date: 14 Mar 2000 15:29:42 GMT
  12. Organization: Columbia University
  13. Message-ID: <8allt6$p76$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16. In article <8ak6qk$qse$1@nnrp1.deja.com>, <jamescurry@my-deja.com> wrote:
  17. : Ok, I'm attempting to write a (very) basic telnet client as an
  18. : experiment. Actually, I'm using it to connect to various talkers,
  19. : NUTS based which don't do very much in following the telnet protocol.
  20. : (They seem to ignore or treat as CR any control codes, in fact the
  21. : only code they ever DO seem to send is the echo control when it's
  22. : time to enter a password).
  23. : My program is sending data out in a character based manner (as soon
  24. : as a key is pressed, sent it with write() over the socket) and
  25. : reading in as much data as it can at once with read(), using select()
  26. : to check if there is any data to be read on the socket. The problem
  27. : is as follows: when a NUTS talker displays a prompt such as "give me
  28. : a name:" on it's login screen, or COM> which is a command prompt, this
  29. : line is NOT terminated by a carriage return, as it's a prompt and the
  30. : user who is telnetting in is meant to make their input on the same
  31. : line. However, these prompts simply aren't seen by my program. In
  32. : fact, neither select() or read() are aware of the existence of this
  33. : line until at least one character has been sent back the other way!
  34. : Therefore, I don't see the "give me a name:" prompt until I press the
  35. : first letter of my name, which then appears not to be displayed as
  36. : the prompt appears on top of it. After reading through the details
  37. : of the telnet protocol, I figured that maybe I needed to do something
  38. : strange like send a GA code. But 255, 249 isn't recognised by the
  39. : talkers, which appears to worsen matters.
  40. : So HELP!!! What am I doing wrong? How can I get my program to see
  41. : these unterminated prompts before it sends any output back to the
  42. : server.
  43. :
  44. There really is no longer any reason for everybody to write their own
  45. Telnet implementation from the ground up.  It's all been done for you 
  46. already in C-Kermit:
  47.  
  48.   http://www.columbia.edu/kermit/ckermit.html
  49.  
  50. This is a Telnet client that:
  51.  
  52.  . Includes its own programming language, allowing you to write your
  53.    application at a high level without needing to know a thing about
  54.    Telnet protocol details, NVTs, etc.
  55.  
  56.  . Runs on every known variety of UNIX, as well as on VMS, VOS, AOS/VS,
  57.    and other platforms.
  58.  
  59.  . Has compatible companion programs for Windows, DOS, OS/2, etc.
  60.  
  61.  . Offers lots of other services including file transfer and management,
  62.    character-set translation, etc, on the Telnet connection.
  63.  
  64.  . Also can make other kinds of connections: dialed, Rlogin, and on some
  65.    platforms X.25, LAT, etc.
  66.  
  67. As you describe your application, it could be programmed very simply about
  68. like this:
  69.  
  70.   .myname = joedoaks
  71.   set host someserver.com /telnet
  72.   if fail exit 1 {Can't make connection}
  73.   input 10 {give me a name:}
  74.   if fail exit 1 {No name prompt}
  75.   lineout \m(myname)
  76.   .\%n = 0
  77.   while true {
  78.       input 10 {COM>}
  79.       if fail {
  80.           increment \%n
  81.           if ( > \%n 10 ) exit 1 {Timeout waiting for command prompt}
  82.           echo WARNING: Missing command prompt - trying again...
  83.           lineout    
  84.           continue
  85.       } else {
  86.           .\%n = 0
  87.           (do whatever you wanted to do here...)
  88.       }    
  89.   }
  90.  
  91. As you can see, the Telnet details are completely transparent to your
  92. program.  Therefore the same script can easily be adapted to other
  93. communication methods.  And it can also be run on hundreds of different
  94. platforms with little or no modification.
  95.  
  96. To see lots of sample Kermit scripts, visit:
  97.  
  98.   http://www.columbia.edu/kermit/ckscripts.html
  99.  
  100. To find out about all that Kermit's telnet client is doing for you
  101. behind the scenes, see:
  102.  
  103.   http://www.columbia.edu/kermit/telnet.html
  104.  
  105. - Frank